//
//  FootView.m
//  SinaWeibo
//
//  Created by Apple on 16/8/20.
//  Copyright © 2016年 Apple. All rights reserved.
//

#import "FootView.h"
#import "StatuesModel.h"

@interface FootView()

@property (weak, nonatomic) IBOutlet UIButton *retweetedBtn;

@property (weak, nonatomic) IBOutlet UIButton *conmentBtn;

@property (weak, nonatomic) IBOutlet UIButton *unlikeBtn;


@end

@implementation FootView

-(void)setStatuesModel:(StatuesModel *)statuesModel{
    
    _statuesModel = statuesModel;
    
    int tenThousand = 10000;
    
    //转发数
    if (statuesModel.reposts_count.integerValue>0) {
        
        if (statuesModel.reposts_count.integerValue > tenThousand) {
            
            long num = statuesModel.reposts_count.integerValue/tenThousand;
            NSString *title = [NSString stringWithFormat:@"%ld万",num];
            [self.retweetedBtn setTitle:title forState:UIControlStateNormal];
            
        }else{
            
            [self.retweetedBtn setTitle:[statuesModel.reposts_count description ] forState:UIControlStateNormal];
        }
    }else{
        
        NSString *title = @"转发";
        
        [self.retweetedBtn setTitle:title forState:UIControlStateNormal];
    }
    
    
    //评论数
    if (statuesModel.comments_count.integerValue>0) {
        
        if (statuesModel.comments_count.integerValue > tenThousand) {
            
            long num = statuesModel.comments_count.integerValue/tenThousand;
            NSString *title = [NSString stringWithFormat:@"%ld万",num];
            [self.conmentBtn setTitle:title forState:UIControlStateNormal];
            
        }else{
            
            [self.conmentBtn setTitle:[statuesModel.comments_count description ] forState:UIControlStateNormal];
        }
    }else{
        
        NSString *title = @"评论";
        
        [self.retweetedBtn setTitle:title forState:UIControlStateNormal];
    }
    
    
    //赞数
    if (statuesModel.attitudes_count.integerValue>0) {
        
        if (statuesModel.attitudes_count.integerValue > tenThousand) {
            
            long num = statuesModel.attitudes_count.integerValue/tenThousand;
            NSString *title = [NSString stringWithFormat:@"%ld万",num];
            [self.unlikeBtn setTitle:title forState:UIControlStateNormal];
            
        }else{
            
            [self.unlikeBtn setTitle:[statuesModel.attitudes_count description ] forState:UIControlStateNormal];
        }
    }else{
        
        NSString *title = @"赞";
        
        [self.retweetedBtn setTitle:title forState:UIControlStateNormal];
    }

    
}

@end
